/**
 * Copyright &copy; 2012-2016 <a href="https://istep.lczyfz.com">Istep</a> All rights reserved.
 */
package com.lczyfz.istep.modules.teach.web;

import com.lczyfz.istep.common.config.Global;
import com.lczyfz.istep.common.persistence.Page;
import com.lczyfz.istep.common.utils.StringUtils;
import com.lczyfz.istep.common.web.BaseController;
import com.lczyfz.istep.modules.resource.entity.*;
import com.lczyfz.istep.modules.resource.service.*;
import com.lczyfz.istep.modules.sys.service.SystemService;
import com.lczyfz.istep.modules.sys.utils.UserUtils;
import com.lczyfz.istep.modules.teach.entity.TeachExam;
import com.lczyfz.istep.modules.teach.entity.TeachStudentPaper;
import com.lczyfz.istep.modules.teach.service.TeachExamService;
import com.lczyfz.istep.modules.teach.service.TeachStudentPaperService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.lang.String;

/**
 * 考试管理Controller
 * @author cqh
 * @version 2017-01-12
 */
@Controller
@RequestMapping(value = "${adminPath}/teach/teachExam")
public class TeachExamController extends BaseController {

	@Autowired
	private TeachExamService teachExamService;


	@Autowired
	private ResourceQuestionAnswerService resourceQuestionAnswerService;

	@Autowired
	private ResourceQuestionOptionService resourceQuestionOptionService;


	@Autowired
	private ResourcePaperService resourcePaperService;

	@Autowired
	private ResourceQuestionService resourceQuestionService;

	@Autowired
	private ResourcePaperQuestionService resourcePaperQuestionService;

	@Autowired
	private SystemService systemService;


	@Autowired
	private TeachStudentPaperService teachStudentPaperService;



	@ModelAttribute
	public TeachExam get(@RequestParam(required=false) String id) {
		TeachExam entity = null;
		if (StringUtils.isNotBlank(id)){
			entity = teachExamService.get(id);
		}
		if (entity == null){
			entity = new TeachExam();
		}
		return entity;
	}



	@RequiresPermissions("teach:teachExam:view")
	@RequestMapping(value = {"list", ""})
	public String list(TeachExam teachExam, HttpServletRequest request, HttpServletResponse response, Model model) {
		Page<TeachExam> page = teachExamService.findPage(new Page<TeachExam>(request, response), teachExam);

		model.addAttribute("page", page);
		return "modules/teach/teachExamList";
	}

	@RequestMapping(value = "stuScorelist")
	public String stuScorelist(TeachExam teachExam, HttpServletRequest request, HttpServletResponse response, Model model) {
		Page<TeachExam> page = teachExamService.findExamStuPageById(new Page<TeachExam>(request, response), teachExam);
		model.addAttribute("page", page);
		return "modules/teach/teachExamScoreList";
	}


	@RequiresPermissions("teach:teachExam:view")
	@RequestMapping(value = "form")
	public String form(TeachExam teachExam, Model model) {
//		AlisaYe添加下发试卷列表
		List<ResourcePaper> allPaperList = teachExamService.findPaperList();
		model.addAttribute("allPaperList", allPaperList);
		model.addAttribute("teachExam", teachExam);
		return "modules/teach/teachExamForm";
	}

	@RequiresPermissions("teach:teachExam:edit")
	@RequestMapping(value = "save")
	public String save(TeachExam teachExam, Model model, RedirectAttributes redirectAttributes) {
		if (!beanValidator(model, teachExam)){
			return form(teachExam, model);
		}
		logger.debug("==******==AlisaYe==******==ClassExam.getIfCheckAnswer[{}]", teachExam.getIfCheckAnswer());
		if((teachExam.getEndDate().getTime()-teachExam.getBeginDate().getTime())<0)
		{
			addMessage(redirectAttributes, "失败！考试开始时间需早于考试结束时间");
			return  "redirect:"+Global.getAdminPath()+"/teach/teachExam/?repage";
		}
		teachExamService.save(teachExam);
		addMessage(redirectAttributes, "保存考试管理成功");
		return "redirect:"+Global.getAdminPath()+"/teach/teachExam/?repage";
	}
	
	@RequiresPermissions("teach:teachExam:edit")
	@RequestMapping(value = "delete")
	public String delete(TeachExam teachExam, RedirectAttributes redirectAttributes) {
		teachExamService.delete(teachExam);
		addMessage(redirectAttributes, "删除考试管理成功");
		return "redirect:"+Global.getAdminPath()+"/teach/teachExam/?repage";
	}

	@RequiresPermissions("teach:teachExam:view")
	@RequestMapping(value = "detail")
	public String detail(TeachExam teachExam, Model model) {
		// TODO
		String teachExamId = teachExam.getId();
		TeachExam teachExam1 = teachExamService.get(teachExamId);
		model.addAttribute("teachExam1", teachExam1);
		model.addAttribute("teachExam", teachExam);
		return "modules/teach/teachExamDetail";
	}


    /**
     * 试卷预览，
     * 通过考试examId得到试卷的Id
     * 在通过试卷id得到试卷的部分
     */

    public ResourcePaper getResourcePaper(String id) {
        ResourcePaper entity = null;
        if (StringUtils.isNotBlank(id)) {
            entity = resourcePaperService.get(id);
        }
        if (entity == null) {
            entity = new ResourcePaper();
        }
        return entity;
    }

    @RequiresPermissions("teach:teachExam:view")
    @RequestMapping(value = "stuExam")
    public String stuExam(TeachExam teachExam, Model model, String examId, String userId) {

        //根据试卷id生成试卷预览
//		logger.debug("====AlisaYe===examId=== [{}]",examId);
        List<ResourcePaper> resourcePaper00 = teachExamService.findPaperByExamId(examId);
        ResourcePaper resourcePaper0 = resourcePaper00.get(0);

        String id = userId;
        System.out.println("=================" + id + "==================");
        String paperId = resourcePaper0.getId();
        ResourcePaper resourcePaper = getResourcePaper(paperId);
//		logger.debug("====AlisaYe===id=== [{}]",id);
//		logger.debug("====AlisaYe===paperId=== [{}]",paperId);
        List<TeachStudentPaper> teachStudentPaper = teachStudentPaperService.findStuAnswerList(id, paperId);
//		logger.debug("====AlisaYe===teachStudentPaper=== [{}]",teachStudentPaper);

        List<TeachStudentPaper> getAllScore = teachStudentPaperService.getAllScoreByUserIdAndPaperId(userId, paperId);
        int stuTotalScore = 0;
        for (int i = 0; i < getAllScore.size(); i++) {
            String s = getAllScore.get(i).getScore();
            logger.debug("====AlisaYe=getAllScore==ssssssssssssssssssssssssss=== [{}]", s);
            stuTotalScore = stuTotalScore + Integer.parseInt(s);
        }
        logger.debug("====AlisaYe=getAllScore==sssssstuTotalScoressssssssss=== [{}]", stuTotalScore);
        String stuTotalScoreS = stuTotalScore + "";

        //================================
//		logger.debug("====AlisaYe===paperId=== [{}]",paperId);
////		获得试卷的所有题目
//		List<ResourceQuestion> resourceQuestionList=teachExamService.findQuesType0ByPaperId(paperId);
//		logger.debug("====AlisaYe===resourceQuestion.size()== [{}]", resourceQuestionList.size());
//		for(int i=0;i<resourceQuestionList.size();i++)
//		{
//		}
        //==============================================

        //----------------------------------

        List<TeachExam> ifCheckAnswerList = teachStudentPaperService.getIfCheckAnswerByExamId(examId);
        String ifCheckAnswer = "1";//默认为0是看不见答案
//		logger.debug("====AlisaYe===ifCheckAnswerList.size()examId== [{}]", examId);
//		logger.debug("====AlisaYe===ifCheckAnswerList.size()== [{}]", ifCheckAnswerList.size());
        if (ifCheckAnswerList.size() > 0) {
            ifCheckAnswer = ifCheckAnswerList.get(0).getIfCheckAnswer();
//			logger.debug("====AlisaYe=size==ifCheckAnswer== [{}]", ifCheckAnswer);
        }
//		logger.debug("====AlisaYe===ifCheckAnswer== [{}]", ifCheckAnswer);

        List<ResourceQuestionAnswer> resourceQuestionAnswer = teachStudentPaperService.getQuestionAnswerList(paperId);

//		if(resourceQuestionAnswer.size()>0)
//		logger.debug("====AlisaYe===resourceQuestionAnswer== [{}]", resourceQuestionAnswer);


        List<ResourceQuestion> resourceQuestionList = new ArrayList<ResourceQuestion>();
        ResourcePaper paper = resourcePaperService.get(paperId);
        ResourcePaperQuestion resourcePaperQuestion = new ResourcePaperQuestion();
        resourcePaperQuestion.setPaperId(paperId);

        List<ResourcePaperQuestion> paperQuestions = resourcePaperQuestionService.findList(resourcePaperQuestion);
        for (ResourcePaperQuestion paperQuestion : paperQuestions) {
            ResourceQuestion question = resourceQuestionService.get(paperQuestion.getQuestionId());
            resourceQuestionList.add(question);
        }
        for (ResourceQuestion question : resourceQuestionList) {
            ResourceQuestionOption option = new ResourceQuestionOption();
            option.setQuestionId(question.getId());

            question.setOption(resourceQuestionOptionService.getByQuestionId(option));
        }

//		AlisaYe20170703---新的页面修改部分控制器（题型分成四类分别处理）
        List<ResourceQuestion> resourceQuestionListRadio = new ArrayList<ResourceQuestion>();
        List<ResourceQuestion> resourceQuestionListCheckbox = new ArrayList<ResourceQuestion>();
        List<ResourceQuestion> resourceQuestionListJudement = new ArrayList<ResourceQuestion>();
        List<ResourceQuestion> resourceQuestionListShortAnswer = new ArrayList<ResourceQuestion>();

        ResourcePaperQuestion resourcePaperQuestionWW = new ResourcePaperQuestion();
//		resourcePaperQuestion.setPaperId(id);//原
//		resourcePaperQuestionWW.setPaperId(id);//改
//		resourcePaperQuestion.setPaperId(paperId);
        resourcePaperQuestionWW.setPaperId(paperId);

//		logger.debug("resourcePaperQuestion.setPaperId(id)",resourcePaperQuestionWW.getPaperId());
        List<ResourcePaperQuestion> paperQuestionsWW = resourcePaperQuestionService.findList(resourcePaperQuestionWW);
//		logger.debug("lsjj===paperQuestionsWW=***123********== [{}]",paperQuestionsWW.size());
        //单选题
        for (ResourcePaperQuestion paperQuestion : paperQuestionsWW) {
            ResourceQuestion question = resourceQuestionService.get(paperQuestion.getQuestionId());
            question.setQuestionScore(String.valueOf(paperQuestion.getScore()));
            if (Integer.valueOf(question.getQuestionType()) == 0) {
                resourceQuestionListRadio.add(question);
            }

        }
        for (ResourceQuestion question : resourceQuestionListRadio) {

            ResourceQuestionOption option = new ResourceQuestionOption();
            option.setQuestionId(question.getId());

            question.setOption(resourceQuestionOptionService.getByQuestionId(option));
        }

        //多选题
        for (ResourcePaperQuestion paperQuestion : paperQuestionsWW) {
            ResourceQuestion question = resourceQuestionService.get(paperQuestion.getQuestionId());
            question.setQuestionScore(String.valueOf(paperQuestion.getScore()));
            if (Integer.valueOf(question.getQuestionType()) == 1) {
                resourceQuestionListCheckbox.add(question);
            }

        }
        for (ResourceQuestion question : resourceQuestionListCheckbox) {

            ResourceQuestionOption option = new ResourceQuestionOption();
            option.setQuestionId(question.getId());

            question.setOption(resourceQuestionOptionService.getByQuestionId(option));
        }

//			判断题
        for (ResourcePaperQuestion paperQuestion : paperQuestionsWW) {
            ResourceQuestion question = resourceQuestionService.get(paperQuestion.getQuestionId());
            question.setQuestionScore(String.valueOf(paperQuestion.getScore()));
            if (Integer.valueOf(question.getQuestionType()) == 2) {
                resourceQuestionListJudement.add(question);
            }

        }
        for (ResourceQuestion question : resourceQuestionListJudement) {

            ResourceQuestionOption option = new ResourceQuestionOption();
            option.setQuestionId(question.getId());

            question.setOption(resourceQuestionOptionService.getByQuestionId(option));
        }

//		简答题
        for (ResourcePaperQuestion paperQuestion : paperQuestionsWW) {
            ResourceQuestion question = resourceQuestionService.get(paperQuestion.getQuestionId());
            question.setQuestionScore(String.valueOf(paperQuestion.getScore()));
            if (Integer.valueOf(question.getQuestionType()) == 3) {
                resourceQuestionListShortAnswer.add(question);
            }

        }
        for (ResourceQuestion question : resourceQuestionListShortAnswer) {

            ResourceQuestionOption option = new ResourceQuestionOption();
            option.setQuestionId(question.getId());

            question.setOption(resourceQuestionOptionService.getByQuestionId(option));
        }

        model.addAttribute("resourceQuestionListRadio", resourceQuestionListRadio);
        model.addAttribute("resourceQuestionListCheckbox", resourceQuestionListCheckbox);
        model.addAttribute("resourceQuestionListJudement", resourceQuestionListJudement);
        model.addAttribute("resourceQuestionListShortAnswer", resourceQuestionListShortAnswer);
        model.addAttribute("resourceQuestionList", resourceQuestionList);
        model.addAttribute("resourcePaper", resourcePaper);
        model.addAttribute("teachStudentPaper", teachStudentPaper);
        model.addAttribute("paperId", paperId);
        model.addAttribute("stuTotalScoreS", stuTotalScoreS);
        model.addAttribute("ifCheckAnswer", ifCheckAnswer);
        model.addAttribute("resourceQuestionAnswer", resourceQuestionAnswer);
        return "modules/teach/stuExamAnswerDetail";
    }


/**
	//我的考试-列表展示
//	@RequiresPermissions("teach:teachExam:view")
//	@RequestMapping(value = {"stuExamList", ""})
	public String stuExamList(TeachExam teachExam, HttpServletRequest request, HttpServletResponse response, Model model) {
//		Page<TeachExam> page = teachExamService.findPage(new Page<TeachExam>(request, response), teachExam);
		//AllisaYe

		String id=UserUtils.getUser().getId();

		Page<TeachExam> page = teachExamService.findExamListPageById(new Page<TeachExam>(request, response), teachExam,id);

		logger.debug("====AlisaYe===page.getList().get(0).getId();=== [{}]",page.getList().get(0).getId());
		model.addAttribute("page", page);
//		List<TeachExam> teachExam0=teachExamService.findExamListById(id);
//		logger.debug("====AlisaYe===teachExam000=== [{}]",teachExam0);
//		model.addAttribute(teachExam0);

		return "modules/teach/stuExamList";
	}



//	 * 试卷预览，
//	 * 通过考试examId得到试卷的Id
//	 * 在通过试卷id得到试卷的部分


	public ResourcePaper getResourcePaper(String id) {
		ResourcePaper entity = null;
		if (StringUtils.isNotBlank(id)){
			entity = resourcePaperService.get(id);
		}
		if (entity == null){
			entity = new ResourcePaper();
		}
		return entity;
	}


//	@RequiresPermissions("teach:teachExam:view")
//	@RequestMapping(value = "stuExamAnswerDetail")
	public String stuExamAnswerDetail(TeachExam teachExam, Model model,String examId) {

		//根据试卷id生成试卷预览
		logger.debug("====AlisaYe===examId=== [{}]",examId);
		List<ResourcePaper> resourcePaper00=teachExamService.findPaperByExamId(examId);
		ResourcePaper resourcePaper0=resourcePaper00.get(0);

		String id=UserUtils.getUser().getId();
		String paperId=resourcePaper0.getId();
		ResourcePaper resourcePaper=getResourcePaper(paperId);
		logger.debug("====AlisaYe===id=== [{}]",id);
		logger.debug("====AlisaYe===paperId=== [{}]",paperId);
		List<TeachStudentPaper> teachStudentPaper=teachStudentPaperService.findStuAnswerList(id,paperId);
		logger.debug("====AlisaYe===teachStudentPaper=== [{}]",teachStudentPaper);

		//================================
//		logger.debug("====AlisaYe===paperId=== [{}]",paperId);
////		获得试卷的所有题目
//		List<ResourceQuestion> resourceQuestionList=teachExamService.findQuesType0ByPaperId(paperId);
//		logger.debug("====AlisaYe===resourceQuestion.size()== [{}]", resourceQuestionList.size());
//		for(int i=0;i<resourceQuestionList.size();i++)
//		{
//		}
		//==============================================

		//----------------------------------

		List<ResourceQuestion> resourceQuestionList = new ArrayList<ResourceQuestion>();
		ResourcePaper paper = resourcePaperService.get(paperId);
		ResourcePaperQuestion resourcePaperQuestion = new ResourcePaperQuestion();
		resourcePaperQuestion.setPaperId(paperId);

		List<ResourcePaperQuestion> paperQuestions = resourcePaperQuestionService.findList(resourcePaperQuestion);
		for(ResourcePaperQuestion paperQuestion : paperQuestions){
			ResourceQuestion question = resourceQuestionService.get(paperQuestion.getQuestionId());
			resourceQuestionList.add(question);
		}
		for(ResourceQuestion question:resourceQuestionList)
		{
			ResourceQuestionOption option = new ResourceQuestionOption();
			option.setQuestionId(question.getId());

			question.setOption(resourceQuestionOptionService.getByQuestionId(option));
		}
		model.addAttribute("resourceQuestionList",resourceQuestionList);

		model.addAttribute("resourcePaper", resourcePaper);

		model.addAttribute("teachStudentPaper", teachStudentPaper);
		model.addAttribute("paperId", paperId);
		//---------------------------------


		//=============================================================
//		ResourceQuestion resourceQuestion=new ResourceQuestion();
//		model.addAttribute("resourceQuestion",resourceQuestion);
//		model.addAttribute("resourceQuestionList",resourceQuestionList);
////		model.addAttribute("teachExam", teachExam);
////		model.addAttribute("resourcePaperQuestion",resourcePaperQuestion);
//		model.addAttribute("resourcePaper", resourcePaper0);
		//=============================================================

		return "modules/teach/stuExamAnswerDetail";
	}




	@ModelAttribute
	public TeachStudentPaper getTeachStudentPaper(String id) {
		TeachStudentPaper entity = null;
		if (StringUtils.isNotBlank(id)){
			entity = teachStudentPaperService.get(id);
		}
		if (entity == null){
			entity = new TeachStudentPaper();
		}
		return entity;
	}

	//进入考试页面
//	@RequiresPermissions("teach:teachExam:view")
//	@RequestMapping(value = "stuExamDoTest")
	public String stuExamDoTest(TeachExam teachExam, Model model,String examId) {

		//根据试卷id生成试卷预览
		TeachExam teachExamTime=teachExamService.findTeachExamByExamId(examId);
		Date teachExamEndDate=teachExamTime.getEndDate();
		logger.debug("====AlisaYe===examId=== [{}]",examId);
		List<ResourcePaper> resourcePaper00=teachExamService.findPaperByExamId(examId);
		ResourcePaper resourcePaper0=resourcePaper00.get(0);

		String id=UserUtils.getUser().getId();
		String paperId=resourcePaper0.getId();
		ResourcePaper resourcePaper=getResourcePaper(paperId);
		logger.debug("====AlisaYe===id=== [{}]",id);
		logger.debug("====AlisaYe===paperId=== [{}]",paperId);
		List<TeachStudentPaper> teachStudentPaper=teachStudentPaperService.findStuAnswerList(id,paperId);
		logger.debug("====AlisaYe===teachStudentPaper=== [{}]",teachStudentPaper);

		List<ResourceQuestion> resourceQuestionList = new ArrayList<ResourceQuestion>();
		ResourcePaper paper = resourcePaperService.get(paperId);
		ResourcePaperQuestion resourcePaperQuestion = new ResourcePaperQuestion();
		resourcePaperQuestion.setPaperId(paperId);

		List<ResourcePaperQuestion> paperQuestions = resourcePaperQuestionService.findList(resourcePaperQuestion);
		for(ResourcePaperQuestion paperQuestion : paperQuestions){
			ResourceQuestion question = resourceQuestionService.get(paperQuestion.getQuestionId());
			resourceQuestionList.add(question);
		}
		for(ResourceQuestion question:resourceQuestionList)
		{
			ResourceQuestionOption option = new ResourceQuestionOption();
			option.setQuestionId(question.getId());

			question.setOption(resourceQuestionOptionService.getByQuestionId(option));
		}
		model.addAttribute("resourceQuestionList",resourceQuestionList);
		model.addAttribute("resourcePaper", resourcePaper);
		model.addAttribute("paperId", paperId);
		model.addAttribute("teachExamEndDate",teachExamEndDate);
//		model.addAttribute("resourceQuestionAA", resourceQuestionList);
//		model.addAttribute("teachStudentPaper", teachStudentPaper);

		return "modules/teach/stuExamDoTest";
	}


//	@RequiresPermissions("teach:teachExam:view")
//	@RequestMapping(value = "answerSave")
	public String stuExamDoTestAnswerSave(TeachExam teachExam, HttpServletRequest request, HttpServletResponse response,  Model model,String paperId,String answerTotalToString,int questionCount){
		String userId=UserUtils.getUser().getId();
		//AlisaYe测试测试传值
		if(paperId!=null){
			logger.debug("====AlisaYe===paperId=== [{}]",paperId);
		}
		if(answerTotalToString!=null){
			logger.debug("====AlisaYe===answerTotalToString=== [{}]",answerTotalToString);
		}
//		从answerTotalToString获取所有题目的答案，进行切分并获得对应题目id和学生答案，存入数据库（前段页面记录显示之前保存的答案）
		teachStudentPaperService.deleteStudentAnswerByuserIdandPaperId(userId,paperId);
		String row=answerTotalToString;
		logger.debug("====AlisaYe===row=== [{}]",row);
		String row1[]=new String[questionCount+1];
		String row2[]=new String[questionCount+1];
		logger.debug("====AlisaYe===questionCount=== [{}]",questionCount);
		//1(!(Question|#|StudentAnswer)!)#(#endQuestion#)#3(!(Question|#|StudentAnswer)!)#(#endQuestion#)#
		//根据拼接的规则把每个题和对应答案切分出来
		row1=row.split("#\\(#endQuestion#\\)#");
		for(int i=0;i<row1.length;i++)
		{
			//切分每一个题目为题目id和学生答案两个部分
			row2=row1[i].split("\\(!\\(Question\\|#\\|StudentAnswer\\)!\\)");
//			logger.debug("====AlisaYe===row1[i]===[{}]",row1[i]);
//			logger.debug("====AlisaYe===row2.length===[{}]",row2.length);//如果row2.length==1，说明没有选择答案。
//
//				if(row2.length==2){
//					logger.debug("====AlisaYe===row2[i]===[{}]",row2[0]);//quewtionID
//					logger.debug("====AlisaYe===row2[i]===[{}]",row2[1]);//studentAnswer
//				}
//				if(row2.length==1){
//					logger.debug("====AlisaYe===row2[i]===[{}]",row2[0]);//quewtionID
//					logger.debug("====AlisaYe===studentAnswer======没有答案！");//studentAnswer
//				}
//			questionCount是题目总数量，有多少题目就插入到表teach_studeng_paper多少次数据
//			数据userId-》String userId=UserUtils.getUser().getId();
//			paperId从前一个控制器传过来了
//			每条数据中如果切割的row2.length==1,说明没有作答，默认给答案赋值为“-1”，若row2.length==2，则赋值row2[1]。
//			分值score是判断标准答案表格的答案和学生答案是否相同给出成绩，这个模块暂时不做，待商榷

			//First在数据库中把userId和paperId相同的所有试卷的答案删除。

			//Second向数据库插入一组数据
			TeachStudentPaper studentAnswer=new TeachStudentPaper();
			studentAnswer.setUserId(userId);
			studentAnswer.setPaperId(paperId);
			studentAnswer.setQuestionId(row2[0]);
			if(row2.length==2){
				studentAnswer.setAnswer(row2[1]);
			}
			if(row2.length==1){
				studentAnswer.setAnswer("-1");
			}
			logger.debug("====AlisaYe===studentAnswer[i]===[{}]",studentAnswer);
			teachStudentPaperService.save(studentAnswer);
		}
		//保存答题情况后跳转列表页面
		Page<TeachExam> page = teachExamService.findExamListPageById(new Page<TeachExam>(request, response), teachExam,userId);
//		logger.debug("====AlisaYe===page.getList().get(0).getId();=== [{}]",page.getList().get(0).getId());
		model.addAttribute("page", page);
	return "modules/teach/stuExamList";
    }



*/





}